import numpy as np

# file = np.load(r'/home/tianxj/code/MARL_CAVs/MARL/results/videos/mappo_pis/20250402-090642/average_speed.npy', allow_pickle=True)
# file = np.load(r'/home/tianxj/code/MARL_CAVs/MARL/results/videos/mappo_pis/20250402-090642/episode_rewards.npy', allow_pickle=True)
file = np.load(r'/home/tianxj/code/MARL_CAVs/MARL/results/videos/new/hard-0-5/eval_logs/eval_rewards.npy', allow_pickle=True)

# 检查数据是否为列表嵌套列表
if isinstance(file[0], list):
    # 将列表嵌套列表转换为 NumPy 数组
    flat_data = np.concatenate(file)
else:
    flat_data = file

# 显示具体数据
print("加载的具体数据为:", flat_data)

# 计算数据的平均值
average_value = np.mean(flat_data)

print("加载数据的平均值为:", average_value)
# np.savetxt('.../a/timestamps.txt',file)